<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    98. Validate Binary Search Tree
   </h1>
   <p>
    Given a binary tree, determine if it is a valid binary search tree (BST).
   </p>
   <p>
    Assume a BST is defined as follows:
   </p>
   <ul>
    <li>
     The left subtree of a node contains only nodes with keys
     <strong>
      less than
     </strong>
     the node's key.
    </li>
    <li>
     The right subtree of a node contains only nodes with keys
     <strong>
      greater than
     </strong>
     the node's key.
    </li>
    <li>
     Both the left and right subtrees must also be binary search trees.
    </li>
   </ul>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>
    2
   / \
  1   3
<strong>Output:</strong> true
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
    5
   / \
  1   4
&nbsp;    / \
&nbsp;   3   6
<strong>Output:</strong> false
<strong>Explanation:</strong> The input is: [5,1,4,null,null,3,6]. The root node's value
&nbsp;            is 5 but its right child's value is 4.
</pre>
  </div>
  <div>
   <h1 class="question_title">
    98. 验证二叉搜索树
   </h1>
   <p>
    给定一个二叉树，判断其是否是一个有效的二叉搜索树。
   </p>
   <p>
    假设一个二叉搜索树具有如下特征：
   </p>
   <ul>
    <li>
     节点的左子树只包含
     <strong>
      小于
     </strong>
     当前节点的数。
    </li>
    <li>
     节点的右子树只包含
     <strong>
      大于
     </strong>
     当前节点的数。
    </li>
    <li>
     所有左子树和右子树自身必须也是二叉搜索树。
    </li>
   </ul>
   <p>
    <strong>
     示例&nbsp;1:
    </strong>
   </p>
   <pre><strong>输入:</strong>
    2
   / \
  1   3
<strong>输出:</strong> true
</pre>
   <p>
    <strong>
     示例&nbsp;2:
    </strong>
   </p>
   <pre><strong>输入:
</strong>    5
   / \
  1   4
&nbsp;    / \
&nbsp;   3   6
<strong>输出:</strong> false
<strong>解释:</strong> 输入为: [5,1,4,null,null,3,6]。
&nbsp;    根节点的值为 5 ，但是其右子节点值为 4 。
</pre>
  </div>
 </body>
</html>